package com.csdware.devilsalarm;

import android.util.Log;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class Func_StaticMisc {
    public static void copyFile(File src, File dst) throws IOException {
        FileInputStream inStream = new FileInputStream(src);
        FileOutputStream outStream = new FileOutputStream(dst);
        byte[] buffer = new byte[1024];
        int length;
        while ((length = inStream.read(buffer)) > 0) {
            outStream.write(buffer, 0, length);
        }
        inStream.close();
        outStream.close();
        // Set the last modified time of the destination file to match the source file
        long lastModifiedTime = src.lastModified();
        if (!dst.setLastModified(lastModifiedTime)) {
            Log.w("Activity_Uproar", "Failed to set last modified time for file: " + dst.getName());
        }
    }
}
